<?php
namespace app\index\controller;

use app\index\model\Cate;
use app\index\model\Collect;
use app\index\model\Question;
use app\index\model\Reply;
use app\index\model\Zan;
use think\Db;
use think\Loader;
require_once '../vendor/gt/lib/class.geetestlib.php';

class Gt extends Common
{
	public function ajax()
	{

		define("CAPTCHA_ID", "48a6ebac4ebc6642d68c217fca33eb4d");
		define("PRIVATE_KEY", "4f1c085290bec5afdc54df73535fc361");
		
		$GtSdk = new \GeetestLib(CAPTCHA_ID, PRIVATE_KEY);

		$data = array(
				"user_id" => '345', # 网站用户id
				"client_type" => "web", #web:电脑上的浏览器；h5:手机上的浏览器，包括移动应用内完全内置的web_view；native：通过原生SDK植入APP应用的方式
				"ip_address" => "127.0.0.1" # 请在此处传输用户请求验证时所携带的IP
			);

		$status = $GtSdk->pre_process($data, 1);

		$_SESSION['gtserver'] = $status;
		$_SESSION['user_id'] = $data['user_id'];

		exit($GtSdk->get_response_str());
	}
}